package com.ruoyi.web.controller.system;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.BAbout;
import com.ruoyi.system.service.IBAboutService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 关于Controller
 * 
 * @author ruoyi
 * @date 2025-07-06
 */
@RestController
@RequestMapping("/system/about")
public class BAboutController extends BaseController
{
    @Autowired
    private IBAboutService bAboutService;

    /**
     * 查询关于列表
     */
    @PreAuthorize("@ss.hasPermi('system:about:list')")
    @GetMapping("/list")
    public TableDataInfo list(BAbout bAbout)
    {
        startPage();
        List<BAbout> list = bAboutService.selectBAboutList(bAbout);
        return getDataTable(list);
    }

    /**
     * 导出关于列表
     */
    @PreAuthorize("@ss.hasPermi('system:about:export')")
    @Log(title = "关于", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BAbout bAbout)
    {
        List<BAbout> list = bAboutService.selectBAboutList(bAbout);
        ExcelUtil<BAbout> util = new ExcelUtil<BAbout>(BAbout.class);
        util.exportExcel(response, list, "关于数据");
    }

    /**
     * 获取关于详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:about:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bAboutService.selectBAboutById(id));
    }

    /**
     * 新增关于
     */
    @PreAuthorize("@ss.hasPermi('system:about:add')")
    @Log(title = "关于", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BAbout bAbout)
    {
        return toAjax(bAboutService.insertBAbout(bAbout));
    }

    /**
     * 修改关于
     */
    @PreAuthorize("@ss.hasPermi('system:about:edit')")
    @Log(title = "关于", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BAbout bAbout)
    {
        return toAjax(bAboutService.updateBAbout(bAbout));
    }

    /**
     * 删除关于
     */
    @PreAuthorize("@ss.hasPermi('system:about:remove')")
    @Log(title = "关于", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bAboutService.deleteBAboutByIds(ids));
    }
}
